//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet.Extensibility
{
    public class TreatBooleansAsDoubleAttribute : ParameterConverterAttribute
    {
        public TreatBooleansAsDoubleAttribute()
        {

        }
        public TreatBooleansAsDoubleAttribute(ReferenceOption refMode)
            : base(refMode)
        {
        }
        internal override void ConvertImp(ConversionData data)
        {
            if (data.TargetType == typeof(double))
            {
                if (data.Value is bool)
                {
                    data.Result = (bool)data.Value ? 1.0d : 0.0d;
                    return;
                }

            }
        }
    }
}